<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
		.alert-box{
				background: #fff;
				width: 450px;
				font-family: "微软雅黑";
				color:#666;
				font-size: 16px;
			}
			.alert-box .alert-box-title{
				background: #a90000;
				height: 45px;
				line-height: 45px;
				padding-left: 20px;
				color: #fff;
			}
			.alert-box .alert-main{
				padding: 20px;
				margin: 0;
			}
			.alert-time{
				color:red;
				font-size: 18px;
			}
		</style>
		<script type="text/javascript" src="jquery-1.11.0.min.js"></script>
		<script type="text/javascript">
			// alert("ready");
			$(document).ready(function(){
				// alert("jquery-1.11.0.min.js");
				$("#submit").click(function(){
					var url = "http://localhost:8081/api/userSession";
					var data = '{"data":{"type":"userSession","attributes":{"address":"中国北京市","entName":"飞腾有限公司","phone":"12345678900","password":"123456","loginName":"wangcheng","sex":1,"name":"王总","updateTime":20160604,"avatar":"0","authCode":"895523","email":"483686426123@qq.com"}}}';
					console.log(data);

					 $.ajax({
					        "data": $.parseJSON(data),
					        "type": "POST",
					        "url": url,
					        "headers":{
					        	"action":"reg",
								"Accept":"application/vnd.api+json",
								"Accept-Encoding":"gzip, deflate, sdch",
								"Content-type":"application/vnd.api+json"
							},
							"data":data,
					        "success":function(result){
					            alert("succ");
								console.log(result);
					        },
					        "error":function(req){
					        }
    				});
				});


				$("#updateUser").click(function(){
					alert("updateUser");
					var url = "http://localhost:8081/api/userPrivate/2";
					/*var data = '{"data":{"type":"userPrivate","id":7,"attributes":{"address":"中国北京市","entName":"飞腾有限公司的说法","phone":"12345678900","loginName":"wangcheng","sex":1,"avatar":"0","authCode":"895523","email":"483686426123@qq.com"}}}';*/
					var data = '{"data":{"id":"2","attributes":{"code":null,"loginType":null,"loginName":"zhangshun","createTime":20160604,"name":"张顺","entName":"","password":"zhangshun","avatar":"image/headImg/2016-07-19/null-26b52fca088cb727.jpg","iDavatar":null,"desc":"持之以恒 有责任心","introduce":"      自由职业者与客户的通话时间和工作结果支付他们酬劳。呼叫云可以说是呼叫行业的新社群模式，专家客服领域的Uber。      自由职业者与客户的通话时间和工作结果支付他们酬劳。呼叫云可以说是呼叫行业的新社群模式，专家客服领域的Uber。      自由职业者与客户的通话时间和工作结果支付他们酬劳。呼叫云可以说是呼叫行业的新社群模式，专家客服领域的Uber。      自由职业者与客户的通话时间和工作结果支付他们酬劳。呼叫云可以说是呼叫行业的新社群模式，专家客服领域的Uber。","sex":1,"age":33,"phone":12321232233,"email":"lsdf@sd22f.com","weixin":"zhangsggggggggggg","address":"北京市大立刻就休息","qqnum":"985432157","invite":null,"regWay":0},"relationships":{"role":{"data":null},"edinfo":{"data":null},"language":{"data":null}},"type":"userPrivate"}}';
					console.log(data);

					 $.ajax({
					        "data": $.parseJSON(data),
					        "type": "PATCH",
					        "url": url,
					        "headers":{
								"Accept":"application/vnd.api+json",
								"Accept-Encoding":"gzip, deflate, sdch",
								"ccd-user-id":"2",
								"Content-type":"application/vnd.api+json"
							},
							"data":data,
					        "success":function(result){
					            alert("succ");
								console.log(result);
					        },
					        "error":function(req){
					        }
    				});
				});





				$("#workorderAdd").click(function(){
					alert("workorderAdd");
					var url = "http://localhost:8081/api/workorderAdd";
					var data = '{"data":{"attributes":{"code":null,"content":"追加test 6","createTime":null,"remindTime":null,"additionalType":null},"relationships":{"workorder":{"data":{"type":"workorder","id":"3"}},"additional":{"data":{"type":"user","id":"2"}}},"type":"workorderAdd"}}';
					console.log(data);

					 $.ajax({
					        "data": $.parseJSON(data),
					        "type": "POST",
					        "url": url,
					        "headers":{
								"Accept":"application/vnd.api+json",
								"Accept-Encoding":"gzip, deflate, sdch",
								"Content-type":"application/vnd.api+json"
							},
							"data":data,
					        "success":function(result){
					            alert("succ");
								console.log(result);
					        },
					        "error":function(req){
					        }
    				});
				});

				$("#sign").click(function(){
					alert("sign");
					var url = "http://localhost:8081/api/userTask/1";
					var data = '{"data":{"type":"userTask","id":"1","attributes":{"signstatus":1,"clientSigntime":1465531376}}}';
					 /*var data = '{"data":{"id":"5","attributes":{"code":null,"createTime":1465531376,"effectiveTime":1465704176,"channel":null,"signstatus":1,"clientSigntime":1467343594,"bindPhone":null},"relationships":{"user":{"data":{"type":"user","id":"2"}},"task":{"data":{"type":"task","id":"2"}},"status":{"data":{"type":"dicttype","id":"5"}}},"type":"userTask"}}';*/
					console.log(data);

					 $.ajax({
					        "data": $.parseJSON(data),
					        "type": "PATCH",
					        "url": url,
					        "headers":{
					        	"action":"sign",
								"Accept":"application/vnd.api+json",
								"Accept-Encoding":"gzip, deflate, sdch",
								"Content-type":"application/vnd.api+json"
							},
							"data":data,
					        "success":function(result){
					            alert("succ");
								console.log(result);
					        },
					        "error":function(req){
					        }
    				});
				});




				$("#submit218").click(function(){
					alert("submit");
					var url = "http://123.56.77.218:9080/api/userSession";
				/*	var data = '{"data":{"type":"userSession","attributes":{"address":"中国北京市1136","entName":"飞腾有限公司0711","phone":"","createTime":20160604,"loginName":"wangcheng","sex":1,"name":"王总","updateTime":20160604,"avatar":"0","authCode":"895523","email":"483686426@qq.com","loginTime":null,"loginType":"","asdsdfsd":null}}}';*/
				var data = '{"data":{"attributes":{"token":null,"loginTime":null,"loginName":null,"password":"ssssss","authCode":"dd","code":null,"loginType":null,"createTime":null,"name":null,"entName":null,"avatar":null,"iDavatar":null,"desc":null,"introduce":null,"sex":null,"age":null,"phone":null,"email":"1094688253@qq.com","weixin":null,"address":null,"qqnum":null,"invite":null,"regWay":2},"relationships":{"role":{"data":null},"edinfo":{"data":null},"cstag":{"data":[]},"extendInfo":{"data":null},"language":{"data":[]}},"type":"userSession"}}';
					console.log(data);

					 $.ajax({
					        "data": $.parseJSON(data),
					        "type": "POST",
					        "url": url,
					        "headers":{
								"Accept":"application/vnd.api+json",
								"Accept-Encoding":"gzip, deflate, sdch",
								"Content-type":"application/vnd.api+json"
							},
							"data":data,
					        "success":function(result){
					            alert("succ");
								console.log(result);
					        },
					        "error":function(req){
					        }
    				});
				});


				$("#submitCall").click(function(){
					alert("submit");
					var url = "http://localhost:8081/api/call";
					var data = '{"data":{"type":"call","attributes":{"csPhone":"150000000","direction":2,"called_number":"18396875221"}}}';
					console.log(data);

					 $.ajax({
					        "data": $.parseJSON(data),
					        "type": "POST",
					        "url": url,
					        "headers":{
								"Accept":"application/vnd.api+json",
								"Accept-Encoding":"gzip, deflate, sdch",
								"Content-type":"application/vnd.api+json",
								"ccd-token":"tokentest",
								"ccd-user-id":"1"
							},
							"data":data,
					        "success":function(result){
					            alert("succ");
								console.log(result);
					        },
					        "error":function(req){
					        }
    				});
				});



				$("#resetPassword").click(function(){
					var url = "http://localhost:8081/api/userSession";
					var data = '{"data":{"type":"userSession","attributes":{"newPassword":"123456","regWay":"1","phone":"12345678111111111","createTime":20160604,"loginName":"wangcheng","sex":1,"name":"王总","updateTime":20160604,"avatar":"0","authCode":"895523","email":"48368642611@qq.com"}}}';
					console.log(data);

					 $.ajax({
					        "data": $.parseJSON(data),
					        "type": "POST",
					        "url": url,
					        "headers":{
								"Accept":"application/vnd.api+json",
								"Accept-Encoding":"gzip, deflate, sdch",
								"Content-type":"application/vnd.api+json"
							},
							"data":data,
					        "success":function(result){
					            alert("succ");
								console.log(result);
					        },
					        "error":function(req){
					        }
    				});
				});


				$("#callEvent218").click(function(){
					var url = "http://123.56.77.218:9080/localCall/callEvent";
					/*var data = {
						'content':'{"agentNumber":"110","type":"callEnd","direction":"1","callinNumber":"15012345678"}'
					};*/
					/*var type = $("type").val();
					var agentNumber = $("agentNumber").val();
					var data = {
						'content':'{"agentNumber":"'+ agentNumber +'","type":"'+ type +'"}'
					};*/
					var data = {
						'content':$("#content218").val()
					};
					console.log(data);

					 $.ajax({
					        "data": data,
					        "type": "POST",
					        "url": url,
					        "headers":{
								"Accept":"application/vnd.api+json",
								"Accept-Encoding":"gzip, deflate, sdch"
							},
					        "success":function(result){
					            alert("succ");
								console.log(result);
					        },
					        "error":function(req){
					        }
    				});
				});

				$("#callEvent").click(function(){
					var url = "http://localhost:8081/localCall/callEvent";
				/*	var data = {
						'content':'{"agentNumber":"110","type":"callEnd","direction":"1","callinNumber":"15012345678"}'
					};*/

				/*	var type = $("type").val();
					var agentNumber = $("agentNumber").val();
					var data = {
						'content':'{"agentNumber":"'+ agentNumber +'","type":"'+ type +'"}'
					};*/
					var data = {
						'content':$("#content").val()
					};

					console.log(data);

					 $.ajax({
					        "data":data,
					        "type": "POST",
					        "url": url,
					        "headers":{
								"Accept":"application/vnd.api+json"
							},
					        "success":function(result){
					            alert("succ");
								console.log(result);
					        },
					        "error":function(req){
					        }
    				});
				});

				$("#huaweiAuth").click(function(){
					alert("submit");
					var url = "https://120.33.121.166:443/login/sc";

					$.ajax({
						"type": "POST",
						"url": url,
						"headers":{
//							"Connection":"Keep-Alive",
//							"Accept":"*/*",
							"User-Agent":"V1.1.1",
							"Authorization":'Digest username="+8659524449943",algorithm=MD5'
//							"Authorization":'Digest username="+8659524449943@fj.ctcims.cn",realm="fj.ctcims.cn",nonce="147203037243310413631930266077047378575385794fj.ctcims.cn",uri="/login/sc",response="8136e27e7d5d517a5f0bb6e87c4baf63"'
						},
						"success":function(result){
							alert("succ");
							console.log(result);
						},
						"error":function(req){
						}
					});
				});


				$("#download").click(function(){
					alert("submit");
//					var url = "https://120.33.121.166:443/login/sc";
					var url = $("#url").val();
					var auth = $("#auth").val();
					console.log(url);
					console.log(auth);
					$.ajax({
						"type": "GET",
						"method":"GET",
						"url": url,
						"headers":{
//							"Connection":"Keep-Alive",
							"Accept":"text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2",
							"User-Agent":"V1.1.1",
//							"Authorization":'Digest username="+8659524449943",algorithm=MD5'
							"Authorization":auth
						},
						"success":function(result){
							alert("succ");
							console.log(result);
						},
						"error":function(req){
						}
					});
				});



			});
			
		</script>
	</head>
	<body>
	<div class="alert-box">
		<div class="alert-box">
			<div class="alert-box-title">
				下载测试！<br>

			</div>
			<p class="alert-main">
				<input type="text" style="width: 400px" id="url" value="https://120.33.121.166:8002/ipcc/call/recordfile?recordFolder=139%2F8659524449943&recordFileName=201608241148300818.wav"><br>
				<input type="text" style="width: 400px" id="auth" value="Basic MTQ3MjA0MTg2NjI5NjU5MTE4NTAwMTA3MjY5ODc4OTU3NjIxNDA2NjA2ODM1OjEyMDBANS4yMTkuMjU1LjQy"><br>
				<input type="button" id="download" name="download" value="下载"> 。
			</p>

		</div>
		<div class="alert-box">
			<div class="alert-box-title">
				华为鉴权测试！<br>

			</div>
			<p class="alert-main">
				<input type="button" id="huaweiAuth" name="huaweiAuth" value="华为鉴权"> 。
			</p>

		</div>
		<div class="alert-box">
			<div class="alert-box-title">
				本地测试！<br>

			</div>
			<p class="alert-main">
			<!--	agentNumber : <input type="text" id = "agentNumber" value="1"><br>
				type : <input type="text" id = "type" value="1">  <br>
				callWait,callInBusy,callEnd,callLost,callFailure-->
				<textarea id="content" style=" width: 400px; height: 150px;">
					{"callType": "0", "centerNumber": " 8659522946022", "direction": "0", "endTime": "2016-08-23 07:16:24", "startTime": "2016-08-23 07:16:01", "recordFlag": "1", "mptyFlag": "0", "callee": "018396875221", "caller": " 8659524449943", "transferFlag": "0", "agentStartTime": "2016-08-23 07:16:13", "failReason": "1002", "recordFolder": "139/ 8659524449943", "recordFileName": "201608230716135707.wav", "corpId": "22", "agentEndTime": "2016-08-23 07:16:24", "calleeAnswerTime": "2016-08-23 07:16:13", "callRecordId": "UPortal2800-20160823151552-12070177", "operatorName": "yida"}
				</textarea>
				<input type="button" id="callEvent" name="callEvent" value="事件通知"> 。
			</p>
			
		</div>
		<div class="alert-box">
			<div class="alert-box-title">
				218测试！
			</div>
			<p class="alert-main">
			<!--	agentNumber : <input type="text" id = "agentNumber" value="1"><br>
				type : <input type="text" id = "type" value="1">  <br>
				callWait,callInBusy,callEnd,callLost,callFailure-->
				<textarea id="content218" style=" width: 400px; height: 150px;">
					{"callType": "0", "centerNumber": " 8659522946022", "direction": "0", "endTime": "2016-08-23 07:16:24", "startTime": "2016-08-23 07:16:01", "recordFlag": "1", "mptyFlag": "0", "callee": "018396875221", "caller": " 8659524449943", "transferFlag": "0", "agentStartTime": "2016-08-23 07:16:13", "failReason": "1002", "recordFolder": "139/ 8659524449943", "recordFileName": "201608230716135707.wav", "corpId": "22", "agentEndTime": "2016-08-23 07:16:24", "calleeAnswerTime": "2016-08-23 07:16:13", "callRecordId": "UPortal2800-20160823151552-12070177", "operatorName": "yida"}
				</textarea>
				<input type="button" id="callEvent218" name="callEvent218" value="事件通知"> 。
			</p>
			
		</div>
		<div class="alert-box">
			<div class="alert-box-title">
				本地测试！
			</div>
			<p class="alert-main">
				<input type="button" id="submit" name="submit" value="本地user注册"> 。
			</p>
			
		</div>
		<div class="alert-box">
			<div class="alert-box-title">
				本地测试！
			</div>
			<p class="alert-main">
				<input type="button" id="updateUser" name="updateUser" value="修改user"> 。
			</p>
			
		</div>
		<div class="alert-box">
			<div class="alert-box-title">
				本地测试！
			</div>
			<p class="alert-main">
				<input type="button" id="workorderAdd" name="workorderAdd" value="本地工单追加"> 。
			</p>
			
		</div>
		<div class="alert-box">
			<div class="alert-box-title">
				本地测试！
			</div>
			<p class="alert-main">
				<input type="button" id="sign" name="sign" value="本地userTask签到"> 。
			</p>
			
		</div>
		<div class="alert-box">
			<div class="alert-box-title">
				本地测试！
			</div>
			<p class="alert-main">
				<input type="button" id="resetPassword" name="resetPassword" value="本地密码重置"> 。
			</p>
			
		</div>
		<div class="alert-box">
			<div class="alert-box-title">
				本地测试！
			</div>
			<p class="alert-main">
				<input type="button" id="submitCall" name="submitCall" value="本地call"> 。
			</p>
			
		</div>
		<div class="alert-box">
			<div class="alert-box-title">
				218测试！
			</div>
			<p class="alert-main">
				<input type="button" id="submit218" name="submit218" value="218user注册"> 。
			</p>
			
		</div>



	</body>
</html>
